package com.normal.zbase.impl.base

import androidx.annotation.NonNull
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.viewpager2.adapter.FragmentStateAdapter

/**
 * Created by zsf on 2023/3/28 15:27
 * ******************************************
 * *
 * ******************************************
 */
class BaseViewPager2Adapter : FragmentStateAdapter {
    private var fragmentList = mutableListOf<Fragment>()

    constructor(
        @NonNull fragmentActivity: FragmentActivity,
        fragmentList: MutableList<Fragment>
    ) : super(fragmentActivity) {
        this.fragmentList = fragmentList
    }

    override fun getItemCount(): Int {
        return fragmentList.size
    }

    override fun createFragment(position: Int): Fragment {
        return fragmentList.get(position)
    }
}